package com.dzu.gulimall.order.feign;

import com.dzu.common.utils.R;
import com.dzu.gulimall.order.vo.FareVo;
import com.dzu.gulimall.order.vo.WareSkuLockVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author by ZhaoDong
 * @Classname WareFeignService
 * @Description 调用远程仓库
 * @Date 2021/6/17 20:09
 */
@FeignClient("gulimall-ware")
public interface WareFeignService {

    /**
     * 1、R设计的时候加上泛型
     * 2、直接返回我们想要的数据
     * 3、自己封装解析结果
     *
     * @param skuId
     * @return
     */
    @PostMapping("/ware/waresku/hasStock")
    R getSkuHasStock(@RequestBody List<Long> skuId);


    @RequestMapping("ware/wareinfo/fare/{addrId}")
    FareVo getFare(@PathVariable("addrId") Long addrId);

    @PostMapping("ware/waresku/order/lock")
    R orderLockStock(@RequestBody WareSkuLockVo vo);
}
